#ifndef __GBUTTON_H__
#define __GBUTTON_H__

#include "GWindow.h"
#include <vector>
#include "GSingal.h"
#include <string>
using namespace std;


enum E_ButtonState
{
	E_BS_Press,
	E_BS_Hover,
	E_BS_Normal,
	E_BS_Disable
};


class CGButton  : public CGWindow
{
public:
	GtkWidget *m_pButton;
	GtkWidget *m_pDisableImage;
	GtkWidget *m_pPressImage;
	GtkWidget *m_pHoverImage;
	GtkWidget *m_pNormalImage;

	E_ButtonState m_eState;

	CGSignal  G_MSG_CLICK;
	CGSignal  G_MSG_HOVER;
	
	CGSignal G_MSG_ENTER;
	CGSignal G_MSG_LEAVE;

	std::string   m_strOri;
	GtkWidget *m_pLabel;
public:
	CGButton(void);
	~CGButton(void);

	virtual void show();
	virtual void hide();
	virtual void create( const char* bg_file = NULL );
	virtual void setPosition( int x, int y);
	virtual void setSize( int x, int y);

	void setImageSizePos( int w, int h, int x, int y);
	void setImagePos( int x, int y);
	void setImageSize( int w, int h);

	virtual CGPoint getPosition();
	virtual CGPoint size();
	virtual void advanceTime( float fElaspedTime );

	virtual bool isPari( GtkWidget *_pGw);
	


	void press();
	void release();
	void hover( );
	void leave();

	void createNormalImg( const gchar *filename );
	void createPressImg(  const gchar *filename );
	void createHoverImg(  const gchar *filename );
	void createDisableImg(  const gchar *filename );


	virtual void enabled();
	virtual void disable();
	virtual void updateLanguage();

	virtual void showEX() {}
	virtual void hideEX(){}

	virtual void setAlpha( float fAlpha ){}
private:
	virtual void _stateUpdate( E_ButtonState _state);
};


#endif//__GBUTTON_H__
